Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

million checkboxes ui #7

Merged
merged 2 commits into from
Nov 5, 2024
Merged

million checkboxes ui #7

merged 2 commits into from
Nov 5, 2024

Conversation

ldanilek
Copy link
Collaborator

@ldanilek ldanilek commented Nov 5, 2024

customers are requesting an example repo for a component that has a UI, so let's give them one.

shamelessly copied from https://github.com/atrakh/one-million-checkboxes

two small changes:

  • it uses the ShardedCounter component to track the count. kind of redundant since the UI already subscribes to all of the data, but if we shifted the query to be paginated this would be useful. and it's a good example of the component.
  • create checkbox data lazily instead of requiring you to call seed
Screenshot 2024-11-04 at 7 05 59 PM

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@ldanilek ldanilek requested a review from atrakh November 5, 2024 00:04
@ldanilek ldanilek merged commit 83dfbc7 into main Nov 5, 2024
1 check passed
@@ -4,8 +4,9 @@
"type": "module",
"version": "0.0.0",
"scripts": {
"dev": "convex dev --live-component-sources",
"dev:backend": "convex dev --live-component-sources",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this have --typecheck-components too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that in the template now? i can add it

Comment on lines +99 to +122
export const seed = internalMutation({
args: {},
handler: async (ctx) => {
const boxes = await ctx.db
.query("checkboxes")
.withIndex("idx")
.order("asc")
.collect();
// Clear the table.
for (const box of boxes) {
await ctx.db.delete(box._id);
}

const bytes = new Uint8Array(BOXES_PER_DOCUMENT / 8);

// Reset the table.
for (let i = 0; i < NUM_DOCUMENTS; i++) {
await ctx.db.insert("checkboxes", {
idx: i,
boxes: bytes.buffer,
});
}
},
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you still need this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope

@ianmacartney
Copy link
Contributor

ianmacartney commented Nov 5, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants